<template>
	<div>
		<textarea v-model="d" @drop="onDrop" class="textarea"></textarea>

		<span @click="onTest">test</span>
	</div>
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue'
import { mapGetters, mapState, useStore } from "vuex";
import * as events from "events";
import fs from "fs";

export default defineComponent({
	name: "Page__Input",
	data() {
		return {
			num: 1234567,
			d: undefined
		}
	},

	mounted() {
		console.log(123)
	},

	methods: {
		onDrop(e: any) {
			const path = e.dataTransfer.files[0].path;
			console.log('path', path)
			fs.readFile(path, (err: any, data: any) => {
				console.log('data', data)
				if (err) {
					console.log('err', err)
				}
				this.d = data;
			});
		}
	},

	setup() {
		// 组合是API中使用store
		const store = useStore()

		const storeX = computed(() => store.state.moduleA.x)

		return {
			storeX
		}
	}
})
</script>
<script lang="ts" setup>
function onTest() {
	console.log('test')
}
</script>
<style scoped lang="less">
.textarea {
	max-width: 400px;
	max-height: 200px;
	min-width: 400px;
	min-height: 200px
}
</style>
